# coding: utf-8

from sqlalchemy import Column, String, Integer, Numeric
from marshmallow import Schema, fields
from model.model_base import Base


class DepWorkloadRepStation(Base):
    # 项目部工作量统计表
    __tablename__ = 'DepWorkloadRepStation'
    bureauid = Column(String(2), primary_key=True, comment='供电局编号')
    bureauname = Column(String(50), nullable=True, comment='供电局名称')
    stationid = Column(String(2), primary_key=True, comment='供所编号')
    stationname = Column(String(50), nullable=True, comment='供电所名称')
    problem_number = Column(Integer, nullable=True, comment='问题总数量')
    pending_number = Column(Integer, nullable=True, comment='未处理问题总数量')
    solved_number = Column(Integer, nullable=True, comment='已处理问题总数量')
    pending_percent= Column(Numeric(5,2), nullable=True, comment='未处理占比%')
    openid = Column(String(128), primary_key=True, comment='统计人openID')


class DepWorkloadRepStationSchema(Schema):
    bureauid = fields.String()
    bureauname = fields.String()
    stationid = fields.String()
    stationname = fields.String()
    problem_number = fields.Integer()
    pending_number = fields.Integer()
    solved_number = fields.Integer()
    pending_percent = fields.Number()
    openid = fields.String()


depWorkloadRepStationSchema = DepWorkloadRepStationSchema()
